package com.imooc.framework.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.DoubleStream;
import java.util.stream.Stream;

public class MapDemo {

    public static void main(String[] args) {
        Stream<Employee> stream = Employee.getEmpList().parallelStream();
        List<Employee> result = stream.map(employee -> {
            employee.setAge(200);
            return employee;
        }).collect(Collectors.toList());
        result.forEach(System.out::println);

        //        Stream<String> names = stream.map(Employee::getName);
//        List<String> result = names.collect(Collectors.toList());
//        result.forEach(System.out::println);

//        DoubleStream doubleStream = stream.mapToDouble(Employee::getSalary);
//        Double sum = doubleStream.sum();
//        System.out.println(sum);

//        String str = "a,b,c,d,e";
//        String str1 = "m,n,j";
//        List<String> list = Arrays.asList(str, str1);
//        Stream<String> stream = list.stream().flatMap(MapDemo::f);
//        stream.forEach(System.out::println);

    }
    public static Stream<String> f(String str) {//使用逗号方式分隔的字符串

        String[] strs = str.split(",");
        Stream<String> stream = Arrays.stream(strs);
        return stream;




    }
}
